#include <bits/stdc++.h>

using namespace std;

int dp[500005];

int main() {
  int n, k, mx = 0;
  string b;

  cin >> n >> k >> b;

  // 初始化前k个元素的0的个数
  for (int i = 0; i < k; i++) {
    if (b[i] == '0')
      dp[k-1]++;
  }
  mx = dp[k - 1];

  // 滑动窗口统计最大的0的个数
  for (int i = k; i < n; i++) {
    dp[i] = dp[i - 1] + (b[i] == '0') - (b[i - k] == '0');
    mx = max(mx, dp[i]);
  }
//   for (int i = 0; i < n; i++) {
//     cout << dp[i] << " ";
//   }

  cout << k - mx;
  return 0;
}